package com.brooks.demo;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author Maoyan
 * @data 2020/10/18 15:37
 * @Version 1.0.0
 */
public class TreadSleep {

    public static void tenDown() throws InterruptedException {
        int num = 10;
        while (num>=0){
            Thread.sleep(1000);
            System.out.println(num--);

        }
    }

    public static void main(String[] args) throws InterruptedException {
        //tenDown();
        //获取当前时间
        Date date = new Date(System.currentTimeMillis());

        while (true){
            Thread.sleep(1000);
            System.out.println(new SimpleDateFormat("HH:mm:ss").format(date));
            date = new Date(System.currentTimeMillis());
        }
    }
}
